package com.kangzhan.utils;

import java.util.List;
import java.util.Map;

public class PageUtil {
    public Integer pageSize = 10;
    public Integer pageNum;
    public Integer count;
    public Integer totalPage;
    public Integer dbIndex;

    public List<Map> data;

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        if (pageNum < 1) {
            pageNum = 1;
        }
        this.pageNum = pageNum;
        this.dbIndex = (pageNum - 1) * this.pageSize;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
        this.totalPage = count % this.pageSize == 0 ? (count / this.pageSize) : (count / this.pageSize + 1); ;

    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public Integer getDbIndex() {
        return dbIndex;
    }

    public List<Map> getData() {
        return data;
    }

    public void setData(List<Map> data) {
        this.data = data;
    }
}
